package ihm;

import java.awt.EventQueue;

import javax.swing.JInternalFrame;
import javax.swing.JScrollPane;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.border.TitledBorder;

import metier.Employe;
import metier.Velo;

import dao.DAO_Employe;
import dao.DAO_Velo;

import java.awt.Font;
import java.util.Vector;

public class FenetreVoirVelo extends JInternalFrame
{
	private JTable lstVelo;
	private JPanel panel;
	private Vector<Velo> lesVelos;
	private Object[][] lignes;
	private JScrollPane scrollPane;

	public FenetreVoirVelo()
	{
		setRootPaneCheckingEnabled(false);
		javax.swing.plaf.InternalFrameUI ui = this.getUI();
		((javax.swing.plaf.basic.BasicInternalFrameUI)ui).setNorthPane(null);
		setBorder(null);
		
		this.lesVelos = DAO_Velo.getLesVelos();
		setBounds(100, 100, 710, 440);
		getContentPane().setLayout(null);
		String titres[]={"MARQUE","LIBELLE","TAILLE UTILISATEUR","PRIX", "QUANTITE"};
		lignes=new Object[lesVelos.size()][5];
		int i = 0;
		for (Velo e : lesVelos)
		{
		    	lignes[i][0] = e.getLibelleVelo();
		    	lignes[i][1] = e.libelleType();
		    	lignes[i][2] = e.tailleType();
		    	lignes[i][3] = e.prixType();
		    	lignes[i][4] = e.getQuantite();
		   	i++;
		}
		
		scrollPane = new JScrollPane();
		scrollPane.setBounds(33, 57, 632, 257);
		getContentPane().add(scrollPane);
		this.lstVelo=new JTable(lignes,titres);
		scrollPane.setViewportView(lstVelo);
		
		panel = new JPanel();
		panel.setBorder(new TitledBorder(null, "Voir les v\u00E9los", TitledBorder.LEADING, TitledBorder.TOP, new Font("Tahoma", Font.BOLD, 13)));
		panel.setBounds(10, 27, 674, 325);
		getContentPane().add(panel);

		// Block la saisi du tableau
		lstVelo.setEnabled(false);
		
	}
}
